<?php
namespace wow\notifiers;
use \gnomephp\Configuration;

class AccountMails extends \gnomephp\mvc\Mailer{
        public function __construct(){
                parent::__construct();

                $this->message()->setFrom(
                	array(
                		Configuration::get('site','sender_email') => 'Admin Crew'
                	)
                );
        }


        public function notifyOnEmail($email, $username, $password, $validlink=false){

                $servername = Configuration::get('site','servername');
                $host = Configuration::get('site','serverhost');
                $wow_versions = Configuration::get('site','wow_versions');
                $this->message()->setSubject("Account created at " .  $servername);
                
                $this->message()->setTo(array(((string)$email) =>  'User '.((string) $username)));


                
        		// Send confirm email ? 
				$extrabody = '';
                if ($validlink){
                	$extrabody =
"

Your account is locked until you validate your account.

VALIDATION LINK:
$validlink

"; 
				}
                
                $this->message()->setBody("
Hi $username!

Thanks for registering at $servername.

If you did not register on our site, please ignore this email.

$extrabody

ACCOUNT INFORMATION:
Username: $username
Password: $password



For more information, you may check our website at $host.

Thanks $host
");
                $this->send();

        }
        
        
        
        public function sendResetLink($email, $username, $resetlink){

                $servername = Configuration::get('site','servername');
                $host = Configuration::get('site','serverhost');
                $wow_versions = Configuration::get('site','wow_versions');
                $this->message()->setSubject("Account created at " .  $servername);
                
                $this->message()->setTo(array(((string)$email) =>  'User '.((string) $username)));


                
                $this->message()->setBody("
Hi $username!


You recently asked to reset your $host password. To complete your request, please follow this link:

$resetlink

*Didn't request this change?*
Ignore this email.


Thanks $host
");
                $this->send();

        }       
}